// src/utils/auth.js

export const USER_ROLES = {
  STUDENT: 'student',
  ADMIN: 'admin'
};

export let currentUserRole = null;

export function login(username, password) {
  if (username === 'admin') {
    currentUserRole = USER_ROLES.ADMIN;
  } else {
    currentUserRole = USER_ROLES.STUDENT;
  }
  // 模拟登录成功
  return true;
}

export function logout() {
  currentUserRole = null;
}

export function isAuthenticated() {
  return currentUserRole !== null;
}

export function isAdmin() {
  return currentUserRole === USER_ROLES.ADMIN;
}